package com.eshop.modules.activity.service.mapper;

import org.apache.ibatis.annotations.Select;
import com.eshop.modules.activity.vo.StoreCouponUserVo;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import org.springframework.stereotype.Repository;
import com.eshop.modules.activity.domain.StoreCouponUser;
import com.eshop.common.mapper.CoreMapper;

@Repository
public interface StoreCouponUserMapper extends CoreMapper<StoreCouponUser>
{
    @Select({ "select A.id,A.coupon_title as couponTitle,A.coupon_price as couponPrice,A.end_time as endTime,B.use_min_price as useMinPrice,B.type,B.product_id as productId from store_coupon_user A left join store_coupon B on A.cid = B.id where A.status = 0 AND A.end_time > #{now}   AND A.uid = #{uid}  AND A.use_min_price <= #{price}  ORDER BY B.id DESC" })
    List<StoreCouponUserVo> selectCouponList(@Param("now") final Date now, @Param("price") final double price, @Param("uid") final Long uid);
}
